<template>
  <div class="login">
    <div class="loginwindow">
      <div class="headtitle">请登录</div>
      <div class="input">
        <el-input v-model="userName" placeholder="请输入用户名"></el-input>
      </div>
      <div class="input">
        <el-input v-model="passWord" type="password" placeholder="请输入密码"></el-input>
      </div>
      <div class="button">
        <el-button type="primary" @click="tologin">登录</el-button>
        <el-button @click="clear">取消</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userName: "",
      passWord: "",
    };
  },
  mounted() {
    // console.log(this.$route.query);
  },
  methods: {
    tologin() {
             this.$router.push({
              path:'/user'
            })
      // if ("" == this.userName) {
      //   this.$message({
      //     showClose: false,
      //     message: "请输入用户名",
      //     type: "error"
      //   });
      //   return;
      // }
      // if ("" == this.passWord) {
      //   this.$message({
      //     showClose: false,
      //     message: "请输入密码",
      //     type: "error"
      //   });
      //   return;
      // }
      // var data = {
      //   userAccout: this.userName,
      //   passWord: this.passWord,
      //   idAdmin: "1"
      // };
      // this.$axios
      //   .post('http://localhost:8081/customer/login', data)
      //   .then(res => {
      //     console.log(res)
      //     if (res.data.code == 1) {
      //       sessionStorage.setItem("userName",this.userName)
      //       this.$router.push({
      //         path:'/user'
      //       })
      //     } else {
      //       this.$message({
      //         showClose: false,
      //         message: res.data.msg,
      //         type: "error"
      //       });
      //     }
      //   });
    },
    clear() {
      this.userName = "";
      this.password = "";
    }
  }
};
</script>

<style scoped>
.login {
  background-image: url("../../assets/171534271575167.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  height: 100%;
  width: 100%;
}
.loginwindow {
  height: 300px;
  width: 300px;
  background-color: white;
  position: absolute;
  right: 100px;
  top: 20%;
}
.headtitle {
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 20px;
}
.input {
  width: 80%;
  padding-left: 10%;
  line-height: 60px;
}
.button {
  text-align: center;
  padding-top: 10px;
}
</style>

<style>
.el-input__inner {
  height: 40px !important;
  width: 240px;
}
</style>
